/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.sac.be;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Colao
 */
@Entity
@Table(name = "SAC_SOLICITUD_CREDITO")
@NamedQueries({@NamedQuery(name = "SolicitudCredito.findAll", query = "SELECT s FROM SolicitudCredito s"), @NamedQuery(name = "SolicitudCredito.findByIdSolicitudcredito", query = "SELECT s FROM SolicitudCredito s WHERE s.idSolicitudcredito = :idSolicitudcredito"), @NamedQuery(name = "SolicitudCredito.findByFechaRegistro", query = "SELECT s FROM SolicitudCredito s WHERE s.fechaRegistro = :fechaRegistro"), @NamedQuery(name = "SolicitudCredito.findByMonto", query = "SELECT s FROM SolicitudCredito s WHERE s.monto = :monto"), @NamedQuery(name = "SolicitudCredito.findByNroCuotas", query = "SELECT s FROM SolicitudCredito s WHERE s.nroCuotas = :nroCuotas"), @NamedQuery(name = "SolicitudCredito.findByPlazo", query = "SELECT s FROM SolicitudCredito s WHERE s.plazo = :plazo"), @NamedQuery(name = "SolicitudCredito.findByObservaciones", query = "SELECT s FROM SolicitudCredito s WHERE s.observaciones = :observaciones"), @NamedQuery(name = "SolicitudCredito.findByMotivoExtorno", query = "SELECT s FROM SolicitudCredito s WHERE s.motivoExtorno = :motivoExtorno"), @NamedQuery(name = "SolicitudCredito.findByScoring", query = "SELECT s FROM SolicitudCredito s WHERE s.scoring = :scoring")})
public class SolicitudCredito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID_SOLICITUDCREDITO")
    private Long idSolicitudcredito;
    @Column(name = "FECHA_REGISTRO")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaRegistro;
    @Column(name = "MONTO")
    private Double monto;
    @Column(name = "NRO_CUOTAS")
    private Integer nroCuotas;
    @Column(name = "PLAZO")
    private Integer plazo;
    @Column(name = "OBSERVACIONES")
    private String observaciones;
    @Column(name = "MOTIVO_EXTORNO")
    private String motivoExtorno;
    @Column(name = "SCORING")
    private Double scoring;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "solicitudCredito", fetch = FetchType.LAZY)
    private List<RiesgoSolicitud> riesgoSolicitudCollection;
    @OneToMany(mappedBy = "fidSacSolicitudCredito", fetch = FetchType.LAZY)
    private List<HojaRuta> hojaRutaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "solicitudCredito", fetch = FetchType.LAZY)
    private List<SolicitanteCredito> solicitanteCreditoCollection;
    @JoinColumn(name = "FID_SAC_AUTONOMIA", referencedColumnName = "ID_AUTONOMIA")
    @ManyToOne(fetch = FetchType.LAZY)
    private Autonomia fidSacAutonomia;
    @JoinColumn(name = "FID_SAC_CREDITO", referencedColumnName = "ID_CREDITO")
    @ManyToOne(fetch = FetchType.LAZY)
    private Credito fidSacCredito;
    @JoinColumn(name = "FID_SAC_ESTADO_SOLICITUD_CREDITO", referencedColumnName = "ID_ESTADO_SOLICITUD_CREDITO")
    @ManyToOne(fetch = FetchType.LAZY)
    private EstadoSolicitudCredito fidSacEstadoSolicitudCredito;
    @JoinColumn(name = "FID_SAC_SUB_PRODUCTO", referencedColumnName = "ID_SUB_PRODUCTO")
    @ManyToOne(fetch = FetchType.LAZY)
    private SubProducto fidSacSubProducto;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "solicitudCredito", fetch = FetchType.LAZY)
    private List<AsociacionGarantiaCredito> asociacionGarantiaCreditoCollection;
    @OneToMany(mappedBy = "fidSacSolicitudCredito", fetch = FetchType.LAZY)
    private List<HojaVisita> hojaVisitaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "solicitudCredito", fetch = FetchType.LAZY)
    private List<DocumentoPresentado> documentoPresentadoCollection;
    @OneToMany(mappedBy = "fidSacSolicitudCredito", fetch = FetchType.LAZY)
    private List<GarantiasSolicitud> garantiasSolicitudCollection;

    public SolicitudCredito() {
    }

    public SolicitudCredito(Long idSolicitudcredito) {
        this.idSolicitudcredito = idSolicitudcredito;
    }

    public Long getIdSolicitudcredito() {
        return idSolicitudcredito;
    }

    public void setIdSolicitudcredito(Long idSolicitudcredito) {
        this.idSolicitudcredito = idSolicitudcredito;
    }

    public Date getFechaRegistro() {
        return fechaRegistro;
    }

    public void setFechaRegistro(Date fechaRegistro) {
        this.fechaRegistro = fechaRegistro;
    }

    public Double getMonto() {
        return monto;
    }

    public void setMonto(Double monto) {
        this.monto = monto;
    }

    public Integer getNroCuotas() {
        return nroCuotas;
    }

    public void setNroCuotas(Integer nroCuotas) {
        this.nroCuotas = nroCuotas;
    }

    public Integer getPlazo() {
        return plazo;
    }

    public void setPlazo(Integer plazo) {
        this.plazo = plazo;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    public String getMotivoExtorno() {
        return motivoExtorno;
    }

    public void setMotivoExtorno(String motivoExtorno) {
        this.motivoExtorno = motivoExtorno;
    }

    public Double getScoring() {
        return scoring;
    }

    public void setScoring(Double scoring) {
        this.scoring = scoring;
    }

    public List<RiesgoSolicitud> getRiesgoSolicitudCollection() {
        return riesgoSolicitudCollection;
    }

    public void setRiesgoSolicitudCollection(List<RiesgoSolicitud> riesgoSolicitudCollection) {
        this.riesgoSolicitudCollection = riesgoSolicitudCollection;
    }

    public List<HojaRuta> getHojaRutaCollection() {
        return hojaRutaCollection;
    }

    public void setHojaRutaCollection(List<HojaRuta> hojaRutaCollection) {
        this.hojaRutaCollection = hojaRutaCollection;
    }

    public List<SolicitanteCredito> getSolicitanteCreditoCollection() {
        return solicitanteCreditoCollection;
    }

    public void setSolicitanteCreditoCollection(List<SolicitanteCredito> solicitanteCreditoCollection) {
        this.solicitanteCreditoCollection = solicitanteCreditoCollection;
    }

    public Autonomia getFidSacAutonomia() {
        return fidSacAutonomia;
    }

    public void setFidSacAutonomia(Autonomia fidSacAutonomia) {
        this.fidSacAutonomia = fidSacAutonomia;
    }

    public Credito getFidSacCredito() {
        return fidSacCredito;
    }

    public void setFidSacCredito(Credito fidSacCredito) {
        this.fidSacCredito = fidSacCredito;
    }

    public EstadoSolicitudCredito getFidSacEstadoSolicitudCredito() {
        return fidSacEstadoSolicitudCredito;
    }

    public void setFidSacEstadoSolicitudCredito(EstadoSolicitudCredito fidSacEstadoSolicitudCredito) {
        this.fidSacEstadoSolicitudCredito = fidSacEstadoSolicitudCredito;
    }

    public SubProducto getFidSacSubProducto() {
        return fidSacSubProducto;
    }

    public void setFidSacSubProducto(SubProducto fidSacSubProducto) {
        this.fidSacSubProducto = fidSacSubProducto;
    }

    public List<AsociacionGarantiaCredito> getAsociacionGarantiaCreditoCollection() {
        return asociacionGarantiaCreditoCollection;
    }

    public void setAsociacionGarantiaCreditoCollection(List<AsociacionGarantiaCredito> asociacionGarantiaCreditoCollection) {
        this.asociacionGarantiaCreditoCollection = asociacionGarantiaCreditoCollection;
    }

    public List<HojaVisita> getHojaVisitaCollection() {
        return hojaVisitaCollection;
    }

    public void setHojaVisitaCollection(List<HojaVisita> hojaVisitaCollection) {
        this.hojaVisitaCollection = hojaVisitaCollection;
    }

    public List<DocumentoPresentado> getDocumentoPresentadoCollection() {
        return documentoPresentadoCollection;
    }

    public void setDocumentoPresentadoCollection(List<DocumentoPresentado> documentoPresentadoCollection) {
        this.documentoPresentadoCollection = documentoPresentadoCollection;
    }

    public List<GarantiasSolicitud> getGarantiasSolicitudCollection() {
        return garantiasSolicitudCollection;
    }

    public void setGarantiasSolicitudCollection(List<GarantiasSolicitud> garantiasSolicitudCollection) {
        this.garantiasSolicitudCollection = garantiasSolicitudCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSolicitudcredito != null ? idSolicitudcredito.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SolicitudCredito)) {
            return false;
        }
        SolicitudCredito other = (SolicitudCredito) object;
        if ((this.idSolicitudcredito == null && other.idSolicitudcredito != null) || (this.idSolicitudcredito != null && !this.idSolicitudcredito.equals(other.idSolicitudcredito))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.sac.be.SolicitudCredito[idSolicitudcredito=" + idSolicitudcredito + "]";
    }

}
